<?php

declare(strict_types=1);

namespace App\Repository;

use App\Model\ProjectConfig;

class ProjectConfigRepository extends IRepository
{
    public function __construct(protected readonly ProjectConfig $model) {}

    public function updateByKey(string $key, string $value) : bool
    {
        return (bool) $this->model::query()->where('key', $key)->update(['value' => $value]);
    }

    public function findByKey(string $key) : ?string
    {
        return $this->model::query()->where('key', $key)->value('value');
    }

}